<template>
  <div class="app-container">
    <!-- 查询 -->
    <div class="filter-container">
      <el-row :gutter="0">
        <el-col :xs="24" :sm="12">
          <el-button class="filter-item" @click="refresh()">刷新</el-button>
        </el-col>
        <el-col :xs="24" :sm="12" style="text-align:right;">
        </el-col>
      </el-row>
    </div>
    <!-- 列表 -->
    <el-table v-loading="loading" :data="datas" :height="height" style="width: 100%" border>
      <el-table-column prop="id" label="ID" min-width="50" sortable="custom"/>
      <el-table-column prop="kaoshi_name" label="考试" min-width="180" sortable="custom"/>
      <el-table-column prop="student_xh" label="学号" min-width="50" sortable="custom"/>
      <el-table-column prop="student_name" label="姓名" min-width="50" sortable="custom"/>
      <el-table-column prop="banji_name" label="班级" min-width="50" sortable="custom"/>
      <el-table-column v-for="(item,i) in xuekes" prop="fenshu" :label="item.name" min-width="50" align="center">
        <template slot-scope="scope">
          {{scope.row.chengji[item.id]}}
          <!-- <el-switch v-model="scope.row.ismain" :active-value="1" :inactive-value="0" disabled/> -->
        </template>
      </el-table-column>
      <el-table-column prop="zongfen" label="总分" min-width="50" sortable="custom"/>
      <el-table-column prop="mc_banji" label="班内名次" min-width="50" sortable="custom"/>
      <el-table-column prop="mc_school" label="校名次" min-width="50" sortable="custom"/>
    </el-table>
  </div>
</template>

<script>
import screenHeight from '@/utils/screen-height'
import { listMyStudentChengjiHuizong,} from '@/api/kaoshi_chengji'

export default {
  name: 'KaoshiChengji',
  data() {
    return {
      height: 680,
      loading: false,
      datas: [],
      xuekes:[],
      student_id: this.$route.query.student_id,
      student_name: this.$route.query.student_name
    }
  },
  created() {
    this.height = screenHeight()
    this.list()
  },
  methods: {
    // 列表
    list() {
      this.loading = true
      listMyStudentChengjiHuizong({student_id:this.student_id}).then(res => {
        this.datas = res.data.kaoshengs
        this.xuekes = res.data.xuekes
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    },
    // 刷新
    refresh() {
      this.list()
    },
  }
}
</script>

<style scoped>
.custom-tree-node {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding-right: 8px;
}
</style>
